package com.ytrsoft.bean;

import com.alibaba.fastjson2.JSON;

public class Message {

    // 消息类型
    private Action action;
    // IO流类型
    private IOType type;
    // 消息主体
    private String body;
    // 是否换行
    private Boolean isNewLine;

    public Action getAction() {
        return action;
    }

    public void setAction(Action action) {
        this.action = action;
    }

    public IOType getType() {
        return type;
    }

    public void setType(IOType type) {
        this.type = type;
    }

    public String getBody() {
        return body;
    }

    public void setBody(String body) {
        this.body = body;
    }

    public Boolean getNewLine() {
        return isNewLine;
    }

    public void setNewLine(Boolean newLine) {
        this.isNewLine = newLine;
    }

    @Override
    public String toString() {
        return JSON.toJSONString(this);
    }

    public static Message fromJSON(String payload) {
        return JSON.parseObject(payload, Message.class);
    }

}
